import http from "@/api";
// import { } from "@/api/interface";

export const getDictTypeAllApi = () => {
  return http.get<any>(`/dict/system/type/all`);
};

interface DictDataListParams {
  dictType: string;
  dictLabel: string;
  pageNum: number;
  pageSize: number;
}

export const getDictDataListApi = (params: DictDataListParams) => {
  return http.post<any>(`/dict/system/data/list`, { ...params });
};

interface DictTypeListParams {
  dictName: string;
  dictType: string;
  pageNum: number;
  pageSize: number;
}

export const getDictTypeListApi = (params: DictTypeListParams) => {
  return http.post<any>(`/dict/system/type/list`, { ...params });
};

interface DictTypeAddParams {
  dictName: string;
  dictType: string;
  status: number;
}

export const addDictTypeApi = (params: DictTypeAddParams) => {
  return http.post<any>(`/dict/system/type/create`, { ...params });
};

interface DictTypeEditParams extends DictTypeAddParams {
  dictId: number;
}

export const editDictTypeApi = (params: DictTypeEditParams) => {
  return http.post<any>(`/dict/system/type/update`, { ...params });
};

export const delDictTypeApi = (params: { dictIds: number[] }) => {
  return http.post<any>(`/dict/system/type/delete`, { ...params });
};

interface DictDataAddParams {
  dictType: string;
  dictLabel: string;
  dictValue: string;
  dictSort: number;
  listClass: string;
  status: number;
}
export const addDictDataApi = (params: DictDataAddParams) => {
  return http.post<any>(`/dict/system/data/create`, { ...params });
};

interface DictDataEditParams extends DictDataAddParams {
  dictCode: number;
}

export const editDictDataApi = (params: DictDataEditParams) => {
  return http.post<any>(`/dict/system/data/update`, { ...params });
};

export const delDictDataApi = (params: { dictCodes: number[] }) => {
  return http.post<any>(`/dict/system/data/delete`, { ...params });
};
